package com.ruoyi.api.config;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

import com.ruoyi.payment.wxpay.IWXPayDomain;
import com.ruoyi.payment.wxpay.WXPayConfig;

public class MyWxConfig extends WXPayConfig{
	
	/** 加载证书  这里证书需要到微信商户平台进行下载*/
    private byte [] certData;

    public MyWxConfig() throws  Exception{
        /*InputStream certStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("cert/wxpay/apiclient_cert.p12");
        this.certData = IOUtils.toByteArray(certStream);
        certStream.close();*/
    }

    @Override
    public String getAppID() {
//        return "wx027d1a44fc3c8a6b";
        return "wxc1d15babc0edd273";
    }
 
    @Override
    public String getMchID() {
//        return "1387998502";
        return "1522736231";
    }
 
    @Override
    public String getKey() {
//        return "f39c90a854482304015448adeb47006e";
        return "A14mp13u5lser941A14mp13u5lser941";
    }
 
    @Override
    public InputStream getCertStream() {
        ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
        return certBis;
    }
 
    @Override
    public int getHttpConnectTimeoutMs() {
        return 8000;
    }
 
    @Override
    public int getHttpReadTimeoutMs() {
        return 10000;
    }
    
    @Override
	public IWXPayDomain getWXPayDomain() {
        return new IWXPayDomain() {
            @Override
            public void report(String domain, long elapsedTimeMillis, Exception ex) {
            }
 
            @Override
            public DomainInfo getDomain(WXPayConfig config) {
                return new DomainInfo("api.mch.weixin.qq.com", false);
            }
        };
    }

}
